import request from '@/utils/request'

// 查询出勤列表
export function listAttendance(query) {
  return request({
    url: '/hr/attendance/list',
    method: 'get',
    params: query
  })
}

// 查询出勤详细
export function getAttendance(id) {
  return request({
    url: '/hr/attendance/' + id,
    method: 'get'
  })
}

// 新增出勤
export function addAttendance(data) {
  return request({
    url: '/hr/attendance',
    method: 'post',
    data: data
  })
}

// 修改出勤
export function updateAttendance(data) {
  return request({
    url: '/hr/attendance',
    method: 'put',
    data: data
  })
}

// 删除出勤
export function delAttendance(id) {
  return request({
    url: '/hr/attendance/' + id,
    method: 'delete'
  })
}

// 导出出勤
export function exportAttendance(query) {
  return request({
    url: '/hr/attendance/export',
    method: 'get',
    params: query
  })

}

  // 根据月份自动生成该月默认考勤数据 add by yyf
  export function addCreateDefault(query) {
    return request({
      url: '/hr/attendance/createDefaultAttendances',
      method: 'post',
      params: query
    })

  }


  // 提交保存考勤数据（状态为已确认） add by yyf
  export function addAttendanceConfirm(query) {
    return request({
      url: '/hr/attendance/addAttendanceConfirm',
      method: 'post',
      params: query
    })

  }

